﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;

namespace Runda.EShop.Dal
{
    public partial class SysPageInfoDal
    {

        public DataTable LoadAllFunctionWithPath()
        {
            string sql = @"with cte as
(
select *
,cast('首页 - '+PageName as varchar(max)) as Location 
from [Sys_Page_Info] where ParentPageID is null
union all
select a.*
,cast(b.Location+' - '+a.PageName as varchar(max)) as Location 
from Sys_Page_Info a join cte b on a.ParentPageID = b.PageID
)
select * from cte";

            DbCommand dbcommand = CurrentDatabase.GetSqlStringCommand(sql);
            return CurrentDatabase.ExecuteDataSet(dbcommand).Tables[0];
        }
    }
}
